#include<iostream>
#include<stdio.h>

using namespace std;

int counter;
int n;

int solve() {
   counter = 0;
   for(int i=1; i<=n/2; i++) {
      if(n%i == 0)
         counter += i;
   }
   return (counter == n)? 0: (counter > n)?1:2; 
}

int read() {
   return cin >> n && n != 0;
}

int main() {
   int tmp;
   cout << "PERFECTION OUTPUT" << endl;
   while(read()) {
      tmp = solve();
      if(tmp == 0) {
         printf("%5d  ", n);
         cout << "PERFECT" << endl;
      }
      else if(tmp == 1) {
         printf("%5d  ", n);
         cout << "ABUNDANT" << endl;
      }
      else {
         printf("%5d  ", n);
         cout << "DEFICIENT" << endl;
      }
   }
   cout << "END OF OUTPUT" << endl; 
   return 0;
}
